package com.hl.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hl.sfzy.entity.Appointment;
import com.hl.sfzy.mapper.AppointmentMapper;
import com.hl.sfzy.service.AppointmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AppointmentServiceImpl implements AppointmentService {
    @Autowired
    private AppointmentMapper appointmentMapper;
    @Override
    public Appointment selectById(long id) {
        return appointmentMapper.selectById(id);
    }

    @Override
    public long deleteById(long id) {
        return appointmentMapper.deleteById(id);
    }

    @Override
    public long update(Appointment appointment) {
        return appointmentMapper.update(appointment);
    }

    @Override
    public long insert(Appointment appointment) {
        return appointmentMapper.insert(appointment);
    }

    @Override
    public List<Appointment> getAllList() {
        return appointmentMapper.getAllList();
    }
    @Override
    public PageInfo<Appointment> findByPage(int pageNum, int pageSize, Appointment appointment) {
        PageHelper.startPage(pageNum,pageSize);
        List<Appointment> appointments = appointmentMapper.findByPage(pageNum,pageSize,appointment);
        PageInfo<Appointment> pageInfo = new PageInfo<>(appointments);
        return pageInfo;
    }
}
